﻿using Leo.Awesome.Attachment.MongoDB;
using Leo.Awesome.DictionaryManagement.MongoDB;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.Modularity;
using Volo.Abp.MongoDB;
using Volo.Abp.Uow;

namespace Leo.Awesome.Infrastructure.MongoDB;

[DependsOn(
    typeof(AbpMongoDbModule),
    typeof(InfrastructureDomainModule),
    typeof(AttachmentMongoDbModule),
    typeof(DictionaryManagementMongoDbModule)
    )]
public class InfrastructureMongoDbModule : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        context.Services.AddMongoDbContext<InfrastructureMongoDbContext>(options =>
        {
            options.AddDefaultRepositories();
        });

        Configure<AbpUnitOfWorkDefaultOptions>(options =>
        {
            options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
        });
    }
}
